/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 *
 * @author Minh Luc
 */
@Entity
@Table(name = "Banking", catalog = "P2PDB", schema = "dbo", uniqueConstraints = {
    @UniqueConstraint(columnNames = {"BankNumber"}),
    @UniqueConstraint(columnNames = {"BankPhone"}),
    @UniqueConstraint(columnNames = {"Email"}),
    @UniqueConstraint(columnNames = {"BankName"})})
@NamedQueries({
    @NamedQuery(name = "Banking.findAll", query = "SELECT b FROM Banking b"),
    @NamedQuery(name = "Banking.findByBankId", query = "SELECT b FROM Banking b WHERE b.bankId = :bankId"),
    @NamedQuery(name = "Banking.findByBankName", query = "SELECT b FROM Banking b WHERE b.bankName = :bankName"),
    @NamedQuery(name = "Banking.findByBankPhone", query = "SELECT b FROM Banking b WHERE b.bankPhone = :bankPhone"),
    @NamedQuery(name = "Banking.findByAddress", query = "SELECT b FROM Banking b WHERE b.address = :address"),
    @NamedQuery(name = "Banking.findByEmail", query = "SELECT b FROM Banking b WHERE b.email = :email"),
    @NamedQuery(name = "Banking.findByBankNumber", query = "SELECT b FROM Banking b WHERE b.bankNumber = :bankNumber")})
public class Banking implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "BankId", nullable = false)
    private Integer bankId;
    @Column(name = "BankName", length = 100)
    private String bankName;
    @Column(name = "BankPhone", length = 100)
    private String bankPhone;
    @Column(name = "Address", length = 2147483647)
    private String address;
    @Column(name = "Email", length = 100)
    private String email;
    @Column(name = "BankNumber", length = 20)
    private String bankNumber;
    @OneToMany(mappedBy = "banking")
    private Collection<Payment> paymentCollection;

    public Banking() {
    }

    public Banking(Integer bankId) {
        this.bankId = bankId;
    }

    public Integer getBankId() {
        return bankId;
    }

    public void setBankId(Integer bankId) {
        this.bankId = bankId;
    }

    public String getBankName() {
        return bankName;
    }

    public void setBankName(String bankName) {
        this.bankName = bankName;
    }

    public String getBankPhone() {
        return bankPhone;
    }

    public void setBankPhone(String bankPhone) {
        this.bankPhone = bankPhone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getBankNumber() {
        return bankNumber;
    }

    public void setBankNumber(String bankNumber) {
        this.bankNumber = bankNumber;
    }

    public Collection<Payment> getPaymentCollection() {
        return paymentCollection;
    }

    public void setPaymentCollection(Collection<Payment> paymentCollection) {
        this.paymentCollection = paymentCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (bankId != null ? bankId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Banking)) {
            return false;
        }
        Banking other = (Banking) object;
        if ((this.bankId == null && other.bankId != null) || (this.bankId != null && !this.bankId.equals(other.bankId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Banking[bankId=" + bankId + "]";
    }

}
